package SerialTest1;
import javax.swing.*;
import java.awt.*; 
import java.awt.event.*;

public class mainScreen extends JFrame implements ActionListener, ItemListener{
	
	JFrame f = new JFrame("Serial / Network Tester");
	Label lb = new Label(" -- Test Type Selection -- ");
	CheckboxGroup cbg1 = new CheckboxGroup();
	Checkbox cb1 = new Checkbox(" Serial Test ",false,cbg1);
	Checkbox cb2 = new Checkbox(" Network Test ",false,cbg1);
	JButton bn = new JButton("  Start  ");
	Panel northP = new Panel();
	Panel centerP =new Panel();
	Panel southP =new Panel();

	public mainScreen(String title){
		super(title);
		
		northP.setLayout(new GridLayout(1,2));
		f.setLayout(new BorderLayout());
		
		bn.addActionListener(this);
		cb1.addItemListener(this);
		cb2.addItemListener(this);
		northP.add(lb,"North");
		f.add(northP,"North");
		centerP.add(cb1);
		centerP.add(cb2);
		southP.add(bn);
		f.add(centerP,"Center");
		f.add(southP,"South");
		
		northP.setBackground(new Color(100,105,200));
		centerP.setBackground(new Color(130,180,200));
		southP.setBackground(new Color(80,200,170));

		f.setVisible(true);
		f.setSize(250,200);
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new mainScreen("Serial / Network Tester");

	}

	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub

		Object objbutton = e.getSource();
		Checkbox cc= cbg1.getSelectedCheckbox();
		
		if((JButton)objbutton == bn){
			if(cc == cb1){
				;
			}
			else if(cc == cb2){
				TCPTester.main(null);
			}
		}

	}
	@Override
	public void itemStateChanged(ItemEvent arg0) {
		// TODO Auto-generated method stub
		
	}
}

